<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<%@taglib uri="/authtaglib" prefix="auth" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<title>人员管理</title>

<jsp:include page="/include.jsp"/>
<script type="text/javascript">

function showFileUpload(callbackId) {
    window.top.$('<div/>').dialog({
        href: '${pageContext.request.contextPath}/cnbdw/commons/file_upload.jsp',
        modal: true,
        top: ($(window.top).height() - 400) * 0.5,
        left: ($(window.top).width() - 600) * 0.5,
        width: 400,
        title: '上传附件',
        buttons: [
            {
                text: '保存',
                iconCls: '',
                id: 'fileUploadDialog',
                handler: function () {
                    //获取专题性别参数
                    var d = window.top.$(this).closest('.window-body');
                    if (window.top.fileValidateData()) {
                        window.top.$('#fileUploadForm').form('submit', {
                            url: '${pageContext.request.contextPath}/fileUploadAction!uploadFile.action',
                            success: function (result) {
                                try {
                                    var r = $.parseJSON(result);
                                    if (r.err != null && r.err != '') {
                                        //显示提示信息
                                        $.messager.show({
                                            title: '提示',
                                            msg: r.err
                                        });
                                    } else {
                                        $('#' + callbackId).val(r.msg);
                                        $('#photoPanel').attr('src', '${pageContext.request.contextPath}' + r.msg);
                                        //关闭新增窗口
                                        d.dialog('destroy');
                                    }
                                } catch (e) {
                                    $.messager.alert('提示', result);
                                }
                            }
                        });
                    }
                }
            }
        ],
        onClose: function () {
            window.top.$(this).dialog('destroy');
        }
    });
}


function doPrint(){
	$("#print").hide();
		$("#pho").hide();
		$("#return").hide();
	window.print();
	//$("#pho").show();
		$("#return").show();
	$("#print").show();

};

function doReturn(){
	
	window.history.back(-1); 

};



 //window.setTimeout('doPrint()', 1000);

</script>
</head>
<body class="easyui-layout">


<form id="add_form" method="post">
    <table class="listtable" style="width: 100%;">
        <tr class="row-even">
            <td class="tr_left"><span class="required">*</span>姓名:&nbsp;</td>
            <td class="tr_right">
                <input type="text" name="name" value="${name}" maxlength="200" class="easyui-validatebox"
                       data-options="required:true,missingMessage:'请输入姓名'"/>
            </td>
            <td class="tr_left" rowspan="4" style="vertical-align: bottom;"></td>
            <td class="tr_right" rowspan="4" style="vertical-align: top;">
                <c:choose>
                    <c:when test="${photo != null && photo != ''}">
                        <img id="photoPanel" src="${pageContext.request.contextPath}${photo}" style="width: 150px; max-height: 200px;">
                    </c:when>
                    <c:otherwise>
                        <img id="photoPanel" src="${pageContext.request.contextPath}/images/headpicture/none.png" style="width: 150px; max-height: 200px;">
                    </c:otherwise>
                </c:choose>
            </td>
        </tr>
        <tr>
            <td class="tr_left"><span class="required">*</span>性别:&nbsp;</td>
            <td class="tr_right">
                <label>
                    <input type="radio" name="gender" value="1" disabled="true " <c:if test="${gender =='' || gender == null || gender == 1}">checked="checked" </c:if>/>男
                </label>
                <label>
                    <input type="radio" name="gender" value="0" disabled="true " <c:if test="${gender != null && gender != '' && gender == 0}">checked="checked" </c:if>/>女
                </label>
            </td>
        </tr>
        <tr class="row-even">
            <td class="tr_left"><span class="required">*</span>证件类型:&nbsp;</td>
            <td class="tr_right" >
                <label>
                    <input type="radio" name="cardType" value="2" disabled="true " <c:if test="${cardType =='' || cardType == null || cardType == 2}">checked="checked" </c:if>/>军官证
                </label>
                <label>
                    <input type="radio" name="cardType" value="1"  disabled="true " <c:if test="${cardType != null && cardType != '' && cardType == 1}">checked="checked" </c:if>/>身份证
                </label>
                
            </td>
        </tr>
        <tr>
            <td class="tr_left"><span class="required">*</span>证件号码:&nbsp;</td>
            <td class="tr_right">
                <input type="text" name="cardNo" value="${cardNo}" maxlength="200" disabled="true" class="easyui-validatebox"
                       data-options="required:true,missingMessage:'请输入证件号码'" />
            </td>
        </tr>
        <tr class="row-even">
            <td class="tr_left"><span class="required">*</span>开启定位:&nbsp;</td>
            <td class="tr_right">
                <label>
                    <input type="radio" name="recordPosition" value="1" <c:if test="${recordPosition =='' || recordPosition == null || recordPosition == 1}">checked="checked" </c:if>/>开启
                </label>
                <label>
                    <input type="radio" name="recordPosition" value="0" <c:if test="${recordPosition != null && recordPosition != '' && recordPosition == 0}">checked="checked" </c:if>/>关闭
                </label>
            </td>
            <td class="tr_left"><span class="required">*</span>照片:&nbsp;</td>
            <td class="tr_right" id="pho">
                <input type="text" name="photo" id="photo" value="/images/headpicture/none.png" maxlength="200" class="easyui-validatebox"
                       data-options="required:true,missingMessage:'请上传照片'" readonly/>
                <input type="button" value="上传" onclick="showFileUpload('photo')">
            </td>
        </tr>
        <tr>
            <td class="tr_left"><span class="required">*</span>单位:&nbsp;</td>
            <td class="tr_right" colspan="3">
                <input type="text" name="company" value="${company}" maxlength="200" style="width: 80%;"
                       class="easyui-validatebox" data-options="required:true,missingMessage:'请输入单位名称'"/>
            </td>
        </tr>
        
        <tr>
        	  <td class="tr_left"><span class="required">*</span>人员类型:&nbsp;</td>
            <td class="tr_right">
                <input class="easyui-combobox" name="level" value="${level}" data-options="
					url:'${pageContext.request.contextPath}/levelAction!getLevelSelectData.action',
                    valueField:'id',
                    textField:'name',
                    editable:false,
                    required:true,missingMessage:'请选择人员类型'"/>
            </td>
           </tr>
        <%-- <tr style="display:none;">--%>
        <tr>
            <td class="tr_left"><span class="required">*</span>区域:&nbsp;</td>
            <td class="tr_right" colspan="3">
                <input id="cc" class="easyui-combobox" name="regionId" data-options="valueField:'id',textField:'text',multiple:false,url:'${pageContext.request.contextPath}/message/employeeAction!getRegionJSON.action',required:true,missingMessage:'请选择工作区域',onLoadSuccess:function(){
                var datas = $(this).combobox('getData');
                if(datas != null && datas.length> 0){
                    $(this).combobox('setValue', datas[0].id);
                }
            }">
            </td>
        </tr>
    </table>
  &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
    &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;
  <input type="button" id="print" value="打 印" onclick="doPrint()"/>
   <input type="button" id="return" value="返回" onclick="doReturn()"/>
</form>
</body>
</html>

